home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00377_Index Utilities.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  7.0 KB  |  266 lines

  1. global gGlobalStepCount, gInputField, gModeState, gTickSND, gCurrEntryAttrib, gLocalStepCount, oIndexMediator, gIndxScrollFldK, oSLlookup, oIndexScroller, oTextScroller, gLastYearK, gFirstYearK, gdescfield, gAlphaState
  2.  
  3. on hPlaceEntryRequest pDir
  4.   global gNopeSND
  5.   if the text of field "BltIndexWin1" = " " then
  6.     hearit(gNopeSND)
  7.     abort()
  8.   end if
  9.   hIncrementStep(pDir)
  10.   hMiniFind()
  11.   if gModeState = #CHRO then
  12.     mChroPicDispTest(oTextScroller, 1)
  13.   end if
  14. end
  15.  
  16. on hIncrementStep pDir
  17.   global mouseUp, gNopeSND
  18.   hSetGlobalCounter(gGlobalStepCount + pDir)
  19.   if gGlobalStepCount = 0 then
  20.     hSetGlobalCounter(1)
  21.     hearit(gNopeSND)
  22.     abort()
  23.   end if
  24.   if gModeState <> #EPISSUB then
  25.     if pDir > 0 then
  26.       if gGlobalStepCount > mGetModesMaxEntryNum(oIndexMediator) then
  27.         hSetGlobalCounter(mGetModesMaxEntryNum(oIndexMediator))
  28.         hearit(gNopeSND)
  29.         hReportStatus("That is the last entry in this index.")
  30.         abort()
  31.       end if
  32.       if not (gModeState = #FoundSet) and not (gModeState = #Resources) and not (gModeState = #TOPICS) then
  33.         if hIsAfterCurrList() then
  34.           hSwapToNextList()
  35.         end if
  36.       end if
  37.     else
  38.       if gGlobalStepCount < 1 then
  39.         hSetGlobalCounter(1)
  40.       end if
  41.       if not (gModeState = #FoundSet) and not (gModeState = #Resources) and not (gModeState = #TOPICS) then
  42.         if hIsBeforeCurrList() then
  43.           hSwapToPriorList()
  44.         end if
  45.       end if
  46.     end if
  47.     mConvertGlobaltoLocal(oIndexMediator)
  48.   else
  49.     hSetLocalCounter(gGlobalStepCount)
  50.     if gLocalStepCount > the iIndexLength of oIndexScroller then
  51.       hSetLocalCounter(the iIndexLength of oIndexScroller)
  52.       hearit(gNopeSND)
  53.       hReportStatus("That is the last entry in the index for this series.")
  54.       abort()
  55.     end if
  56.   end if
  57.   if gLocalStepCount > mGetModesMaxEntryNum(oIndexMediator) then
  58.     set gLocalStepCount to 1
  59.   end if
  60.   set LxNtry to getPropAt(mGrabCurrAttrList(oIndexMediator, gModeState), gLocalStepCount)
  61.   if not (gModeState = #FoundSet) then
  62.     put LxNtry into field gInputField
  63.   else
  64.     put mSetOneFTfromLU(oSLlookup, gGlobalStepCount) into field gInputField
  65.   end if
  66.   hilite char 999 of field gInputField
  67. end
  68.  
  69. on hCreateIndexObjs
  70.   global oIndexScroller, oIndexMediator, oSLlookup, oTextScroller
  71.   set oIndexMediator to birth(script "MultiIndex Manager")
  72.   go("OpC4")
  73.   hearit(gBtnHitSND)
  74.   set oSLlookup to birth(script "ShortLong Lookup")
  75.   mPrepEntryLookup(oSLlookup)
  76.   go("OpD1")
  77.   hAnnounce("Memory Alpha")
  78.   set oIndexScroller to birth(script "indexmaker", #E, 7, 1)
  79.   set oTextScroller to birth(script "Scroll Manager")
  80. end
  81.  
  82. on hCapitalize pCharstoCap
  83.   if not voidp(value(pCharstoCap)) and (value(pCharstoCap) < 65) then
  84.     return pCharstoCap
  85.   end if
  86.   set vCharNum to charToNum(pCharstoCap)
  87.   if vCharNum > 96 then
  88.     return numToChar(vCharNum - 32)
  89.   else
  90.     return pCharstoCap
  91.   end if
  92. end
  93.  
  94. on hCapAsNum pCharstoCap
  95.   if not voidp(value(pCharstoCap)) and (value(pCharstoCap) < 65) then
  96.     return pCharstoCap
  97.   end if
  98.   set vCharNum to charToNum(pCharstoCap)
  99.   if vCharNum > 96 then
  100.     return vCharNum - 32
  101.   else
  102.     return vCharNum
  103.   end if
  104. end
  105.  
  106. on hInitCap pWord
  107.   put hCapitalize(char 1 of pWord) into char 1 of pWord
  108.   return pWord
  109. end
  110.  
  111. on hConvertListtoString pTheList, pType
  112.   set Lme to string(pTheList)
  113.   if pType = 1 then
  114.     set Lsz to the number of chars in Lme
  115.     delete char Lsz of Lme
  116.   else
  117.     if pType >= 2 then
  118.       set Lsz to the number of chars in Lme
  119.       delete char Lsz of Lme
  120.       put "," into char 1 of Lme
  121.     else
  122.       if pType = 0 then
  123.       end if
  124.     end if
  125.   end if
  126.   return Lme
  127. end
  128.  
  129. on hAddOnetoMe pVar
  130.   set pVar to hConvertAlphaToItem(pVar)
  131.   if gModeState = #CHRO then
  132.     if pVar >= gLastYearK then
  133.       return string(value(pVar))
  134.     else
  135.       return string(value(pVar) + 1)
  136.     end if
  137.   else
  138.     if pVar >= 90 then
  139.       return hConvertItemtoAlpha(pVar)
  140.     else
  141.       return hConvertItemtoAlpha(pVar + 1)
  142.     end if
  143.   end if
  144. end
  145.  
  146. on hSubtractOnefromMe pVar
  147.   set pVar to hConvertAlphaToItem(pVar)
  148.   if gModeState = #CHRO then
  149.     if pVar <= gFirstYearK then
  150.       return string(value(pVar))
  151.     else
  152.       return string(value(pVar) - 1)
  153.     end if
  154.   else
  155.     if pVar <= 1 then
  156.       return hConvertItemtoAlpha(pVar)
  157.     else
  158.       return hConvertItemtoAlpha(pVar - 1)
  159.     end if
  160.   end if
  161. end
  162.  
  163. on hMatchTbarToWindow
  164.   global oINTERfaceUpdate, oCHROPopup2, oCHROPopup1, oINTERfaceAlph, oINTERfaceEpis, oIndexScroller
  165.   if gModeState = #ENCY then
  166.     mHltfromScripts(oINTERfaceAlph, mGrabCurrItem(oIndexMediator))
  167.   else
  168.     if gModeState = #EPISSUB then
  169.       mHltfromScripts(oINTERfaceEpis, mGrabCurrItem(oIndexMediator))
  170.     else
  171.       if gModeState = #EPIS then
  172.         mHltfromScripts(oINTERfaceEpis, 6)
  173.       else
  174.         if gModeState = #CHRO then
  175.           mHltfromScripts(oCHROPopup1)
  176.           mHltfromScripts(oCHROPopup2)
  177.         else
  178.           if gModeState = #FoundSet then
  179.             set Lwhichbutt to hMatchButtToType(mWhatFSlistType(oIndexScroller))
  180.             mHltfromScripts(oINTERfaceUpdate, Lwhichbutt)
  181.           end if
  182.         end if
  183.       end if
  184.     end if
  185.   end if
  186.   hSysAlert(#LCARSREADY)
  187.   hWinVoiceMicOn()
  188. end
  189.  
  190. on hShowEmbeddedHits
  191.   if gModeState = #FoundSet then
  192.     if mWhatFSlistType(oIndexScroller) = 1 then
  193.       set theitems to mGetThisEntrysAttribs(oIndexMediator, #FoundSet, 1, gLocalStepCount)
  194.       if theitems = 0 then
  195.         exit
  196.       end if
  197.       set tidl to the itemDelimiter
  198.       set the itemDelimiter to ","
  199.       set k to the number of items in string(theitems)
  200.       repeat with n = 1 to k
  201.         set the textStyle of word value(item n of string(theitems)) of field gdescfield to "underline"
  202.       end repeat
  203.       set the itemDelimiter to tidl
  204.     end if
  205.     hSysAlert(#LCARSREADY)
  206.     hWinVoiceMicOn()
  207.   end if
  208. end
  209.  
  210. on hSwapToNextList
  211.   hGetNewAttrList(hAddOnetoMe(gAlphaState), 0)
  212. end
  213.  
  214. on hSwapToPriorList
  215.   hGetNewAttrList(hSubtractOnefromMe(gAlphaState), 0)
  216. end
  217.  
  218. on hIsAfterCurrList
  219.   if gGlobalStepCount > mGetMyLastEntryNum(oIndexMediator, gAlphaState) then
  220.     return 1
  221.   else
  222.     return 0
  223.   end if
  224. end
  225.  
  226. on hIsBeforeCurrList
  227.   if gGlobalStepCount > mGetMyFirstGroupLimit(oIndexMediator) then
  228.     set Lprevitem to hSubtractOnefromMe(gAlphaState)
  229.     if gGlobalStepCount <= mGetMyLastEntryNum(oIndexMediator, string(Lprevitem)) then
  230.       return 1
  231.     else
  232.       return 0
  233.     end if
  234.   else
  235.     return 0
  236.   end if
  237. end
  238.  
  239. on hSwitchBacktoEpis
  240.   set LmyfldName to "A"
  241.   set Lnum to 1
  242.   hSetMode(#EPIS)
  243.   hGetNewAttrList(LmyfldName, 0)
  244.   set vIndexLength to mGetModesMaxEntryNum(oIndexMediator)
  245.   mReDefineSlider(oIndexSlider, 1, vIndexLength - 6, 1)
  246.   mSetSlider(oIndexSlider, 1)
  247.   mShiftWindowToEntry(oIndexScroller, Lnum, 0)
  248. end
  249.  
  250. on hSwitchtoSomeNewList
  251.   hGetNewAttrList("A", 0)
  252.   mShiftWindowToEntry(oIndexScroller, 1, 1)
  253. end
  254.  
  255. on hDragCHROtextBar
  256.   global oCHROTextSlider, oIndexScroller
  257.   set vloc to the mouseV
  258.   set vloc to the mouseH
  259.   mSlideSlider(oCHROTextSlider)
  260.   repeat while the stillDown
  261.     mSlideSlider(oCHROTextSlider)
  262.   end repeat
  263.   mEndIndexToLine(oIndexScroller)
  264.   hIndexClick(3)
  265. end
  266.